{% extends "_base.html" %}

{% block title %}Dashboard{% endblock %}

{% block contents %}
<h1>Streamux</h1>

<table border="1">
<!-- Icecast status -->
{% if icecast_alive %}
<tr><th colspan="2"><img src="/media/good.png"> Icecast</th></tr>
{% else %}
<tr><th colspan="2"><img src="/media/bad.png"> Icecast</th></tr>
{% endif %}

{% if icecast_stats.ogg %}
<tr><td class="desc">Ogg</td><td>Streaming</td></tr>
<tr><td class="desc">&nbsp;&nbsp;Listeners</td>
    <td>{{icecast_stats.ogg.listeners}}</td></tr>
<tr><td class="desc">&nbsp;&nbsp;Current track</td>
    <td>{{icecast_stats.ogg.current}}</td></tr>
{% else %}
<tr><td class="desc">Ogg</td><td>Dead</td></tr>
{% endif %}

{% if icecast_stats.mp3 %}
<tr><td class="desc">Mp3</td><td>Streaming</td></tr>
<tr><td class="desc">&nbsp;&nbsp;Listeners</td>
    <td>{{icecast_stats.mp3.listeners}}</td></tr>
<tr><td class="desc">&nbsp;&nbsp;Current track</td>
    <td>{{icecast_stats.mp3.current}}</td></tr>
{% else %}
<tr><td class="desc">Mp3</td><td>Dead</td></tr>
{% endif %}

<!-- Liq status -->
{% if liq_alive %}
<tr><th colspan="2"><img src="/media/good.png"> Liquidsoap</th></tr>
<tr><td class="desc">Uptime</td><td>{{liq_uptime}}</td></tr>
<tr><td class="desc">Status</td><td>{{liq_meta.status|capfirst}}</td></tr>
<tr><td class="desc">Source</td><td>{{liq_meta.source|capfirst}}</td></tr>
<tr><td class="desc">Current track</td><td>{{liq_meta.artist}} - {{liq_meta.title}}</td></tr>
{% else %}
<tr><th colspan="2"><img src="/media/bad.png"> Liquidsoap</th></tr>
<tr><td class="desc">Status</td><td>Dead</td></tr>
{% endif %}

<!-- Importer status -->
{% if daemon_alive %}
<tr><th colspan="2"><img src="/media/good.png"> Importer</th></tr>
<tr><td class="desc">Status</td><td>Up</td></tr>
{% else %}
<tr><th colspan="2"><img src="/media/bad.png"> Importer</th></tr>
<tr><td class="desc">Status</td><td>Dead</td></tr>
{% endif %}

<!-- Music DB status -->
<tr><th colspan="2"><img src="/media/good.png"> Music DB</th></tr>
<tr><td class="desc">Artists</td><td>{{artists}}</td></tr>
<tr><td class="desc">Albums</td><td>{{albums}}</td></tr>
<tr><td class="desc">Tracks</td><td>{{tracks}}</td></tr>
</table>

{% endblock %}
